# Contributor: kohnish <kohnish@gmx.com>
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=buildah
pkgver=1.37.5
pkgrel=0
pkgdesc="tool that facilitates building OCI container images"
url="https://github.com/containers/buildah"
license="Apache-2.0"
arch="all"
depends="oci-runtime shadow-subids slirp4netns containers-common"
makedepends="go go-md2man lvm2-dev gpgme-dev libseccomp-dev btrfs-progs-dev bash"
subpackages="$pkgname-doc"
options="!check" # tests require root privileges
source="https://github.com/containers/buildah/archive/v$pkgver/buildah-$pkgver.tar.gz
	basename.patch
	"

# secfixes:
#   1.37.5-r0:
#     - CVE-2024-9675
#     - CVE-2024-9676
#   1.37.4-r0:
#     - CVE-2024-9341
#     - CVE-2024-9407
#   1.35.4-r0:
#     - CVE-2024-1753
#     - CVE-2024-3727
#     - CVE-2024-24786
#     - CVE-2024-28180
#   1.34.0-r1:
#     - CVE-2023-48795
#   1.28.0-r0:
#     - CVE-2022-2990
#   1.21.3-r0:
#     - CVE-2021-3602
#   1.19.4-r0:
#     - CVE-2021-20206
#   1.14.4-r0:
#     - CVE-2020-10696

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	GIT_COMMIT="$pkgver" make buildah
	GIT_COMMIT="$pkgver" make -C docs GOMD2MAN="$(which go-md2man)"
}

package() {
	GIT_COMMIT="$pkgver" make install PREFIX=/usr DESTDIR="$pkgdir"
}

sha512sums="
ee33d85ea3aa9ec423b4e48e19db69359e3fc480a61abd511fa473257aa326e9a9c4dafc985afb83f7caa9a7a5ba6a89b2a1c028fe6ef7bd4ef382ec8591331d  buildah-1.37.5.tar.gz
d3afcafe2fdd72f4afa42c157e9cd4b73cc6347aaeb82fe8c2b7888d6070344177e8ef21ccc7e0618351cf6f83492073990bad06572a3a6c433dcfc5c8e968de  basename.patch
"
